<!--
 * @Author: your name
 * @Date: 2022-03-09 10:30:08
 * @LastEditTime: 2022-03-09 10:35:24
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \day09\3-阻止事件的默认行为.html
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        window.onload=function(){
            var button=document.getElementsByTagName('button')[0];
            var a=document.getElementsByTagName('a')[0];
           /*  button.onclick=function(event){
                event.preventDefault()
            }
            a.onclick=function(event){
                event.preventDefault()
            } */
        }
    </script>
</head>
<body>
    <form action="./1-事件.html">
        <button type="submit">提交按钮</button>
    </form>
    <a href="www.baidu.com">baidu</a>
</body>
</html>